package com.itheima.thread03;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.FutureTask;

public class Demo {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        //创建MyCallable对象
        MyCallable mc = new MyCallable();
        //创建Future对象
        FutureTask<String> sft = new FutureTask<String>(mc);
        //创建Thread线程对象对象
        Thread thread = new Thread(sft);
        //开启线程
        thread.start();
        //得到线程完毕之后的数据
        String s = sft.get();
        System.out.println(s);


    }
}
